Meteor.methods
	saveUserOrder: (data) ->
		if Meteor.userId()

			Order.insert
				username:data.username,
				mobile:data.mobile,
				idnumber:data.idnumber,
				tdate:data.tdate,
				startstation:data.startstation,
				endstation:data.endstation,
				trainnumber:data.trainnumber,
				trainlevel:data.trainlevel,
				status:data.status,
				createdAt:new Date()
				owner: Meteor.userId(),
				ownername:Meteor.user().username




			return true

	updateUserOrder: (oid,data) ->
		if Meteor.userId()
			Order.update({_id:oid},$set:{status:data.status,username:data.username,mobile:data.mobile,idnumber:data.idnumber,tdate:data.tdate,startstation:data.startstation,endstation:data.endstation,trainnumber:data.trainnumber,trainlevel:data.trainlevel})

			return true

	deleteOrder: (oid) ->
		if Meteor.userId()

			Order.remove({_id:oid})
